<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
  <title>XAdmin - Administraci&oacute;n de requerimientos</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" type="text/css" href="../js/extjs/resources/css/ext-all.css">
    <link rel="stylesheet" type="text/css" href="../css/xadmin.css">
    <script type="text/javascript" src="../js/extjs/adapter/ext/ext-base.js"></script>
    <script type="text/javascript" src="../js/extjs/ext-all-debug.js"></script>
    <script type="text/javascript" src="../js/extjs/build/locale/ext-lang-es.js"></script>
    <script type="text/javascript" src="../js/widgets/Ext.ux.grid.Search.js"></script>
    <script type="text/javascript" src="../js/widgets/Ext.ux.IconMenu.js"></script>
    <script type="text/javascript" src="../js/widgets/Ext.ux.grid.RowActions.js"></script>
    <script type="text/javascript" src="../js/widgets/Ext.ux.grid.RecordForm.js"></script>
	<script type="text/javascript" src="../js/widgets/Ext.ux.grid.RESTGridNew.js"></script>
	<script type="text/javascript">
	var xadmin = {};
	xadmin.init = function()
	{
		Ext.BLANK_IMAGE_URL = "../js/extjs/resources/images/default/s.gif";
		Ext.QuickTips.init();
		Ext.form.Field.prototype.msgTarget = "side";
		var rowActions = new Ext.ux.grid.RowActions({
			  header: 'H'
			, actions : [{
				  qtipIndex:'qtip3'
				, iconCls:'icon-edit'
				, tooltip:'User'
			}]
		});
		rowActions.on({
			action:function(grid, record, action, row, col) {
				alert("Hola");
			}
		});
		restGrid = new Ext.ux.grid.RESTGrid({
				resourceURL: '/projects',
				height: 200,
				title : 'Proyectos'
				, renderTo: 'risk-grid'
		, rowActions : rowActions
        , cm : new Ext.grid.ColumnModel([
			{header: "Nombre", width: 200, dataIndex: 'name', editor: new Ext.form.TextField({allowBlank: false, xtype: 'textfield'})},
			{header: "Cliente", dataIndex: 'client', editor: new Ext.form.TextField({allowBlank: false, xtype: 'textfield'})},
			{header: "Descripcion", width: 300, dataIndex: 'description', editor: new Ext.form.TextArea({allowBlank: false, xtype: 'textarea'})},
			{header: "Inicio", dataIndex: 'start', renderer: Ext.util.Format.dateRenderer('Y-m-d'), editor: new Ext.form.DateField({format: 'Y-m-d', xtype: 'datefield'})},
			{header: "Fin", dataIndex: 'end', renderer: Ext.util.Format.dateRenderer('Y-m-d'), editor: new Ext.form.DateField({format: 'Y-m-d', xtype: 'datefield'})},
			rowActions
		])
			, reader : new Ext.data.XmlReader({
		               record: 'project',
		               id: '@id'
		           }, [
		               'name',
					   'client',
		               'description',
					   {name:'start', type: 'date', dateFormat: 'Y-m-d'},
					   {name: 'end', type: 'date', dateFormat: 'Y-m-d'}
					   , {name: 'action1', type: 'string'}
		           ])


		, view : new Ext.grid.GroupingView({
		  	forceFit : true
			, groupTextTpl : '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "Items" : "Item"]})'
			, emptyText : 'No hay proyectos.'
			})
		});
	};

	Ext.onReady(xadmin.init, xadmin, true);
</script>
</head>
<body>
	<div id="risk-grid" ></div>
</body>
</html>
